<template>
	<div class="story-list">
		<h3>story list</h3>
		<ul>
			<li v-for="(item,index) in slist" :key="index">{{item}}</li>
		</ul>
		<el-button type="primary" @click="createStory">添加小说</el-button>
	</div>
</template>

<script>
import * as web3CTR from '@/utils/web3-ctr'
export default {
	name: 'story-list',
	data(){
		return{
			slist:[]
		}
	},
	created(){
		this.storyList()
	},
	methods:{
		async storyList(){
			await web3CTR.storyList().then((res)=>{
				console.log("slist: ",this.slist)
				this.slist = res
			})
			
		},
		async createStory(){
			// var headAddress = await web3CTR.deployStoryHead({title:"人工智障与程序员",brief:"只是搞笑的,哈哈哈"})
			// console.log("headAddress", headAddress)
			web3CTR.addStoryToIndex({title: "人工智障与程序员",address: "0x4A16e71d0bF7aE6D168A71a562F3A1b3259f9bFd"})
		}
	}
}
// 0x1e0a43427d1B2c10BBE26aF3bA696c2DDee445a4
</script>
